// 笔试强训day31:小红的口罩

#include <iostream>
#include <queue>
using namespace std;

int main() {
    int n, k, a; cin >> n >> k;
    priority_queue<int, vector<int>, greater<int>> heap;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        heap.emplace(a);
    }

    int sum = 0, day = 0;
    while(sum <= k)
    {
        day++;
        int tmp = heap.top();
        heap.pop();
        sum += tmp;
        heap.emplace(tmp * 2);
    }
    cout << day - 1 << endl;
}